#coding: utf-8

from django.http import Http404
from models import Salesperson
from django.http import HttpResponse,HttpResponseRedirect

def login_required (func):
    def newfunc (request,**argkw):
        try:
            saleid=request.session['id']
        except:
            saleid=0
        try:
            sale_obj=Salesperson.objects.get(id=saleid)
        except Admininfo.DoesNotExist:
            #raise Http404,'账号不存在'
            return HttpResponseRedirect("/index/")
        return func(request,**argkw)
    return newfunc

